﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Skyworth.CRM.Service.Entity;
using Skyworth.CRM.Service.IBLL;
using Skyworth.CRM.Service.IDAL;

namespace Skyworth.CRM.BLL
{
    public class ProductBLL:IProductBLL
    {
        private IProductDAL _productDal;

        public ProductBLL(IProductDAL productDal)
        {
            _productDal = productDal;
        }
        public DataTable GetProductsByPage(string strWhere, string strOrderBy, int pageIndex, int pageSize, out int recordCount, out int pageCount)
        {
            return _productDal.GetProductsByPage(strWhere, strOrderBy, pageIndex, pageSize, out recordCount,
                                                 out pageCount);
        }

        public void Delete(int productId)
        {
           _productDal.Delete(productId);
        }

        public Product GetProductById(int productId)
        {
           return _productDal.GetProductById(productId);
        }

        public void Add(Product product)
        {
            _productDal.Add(product);
        }

        public void Update(Product product)
        {
            _productDal.Update(product);
        }

        public DataTable Query(string strWhere)
        {
            return _productDal.Query(strWhere);
        }

        public DataTable GetPriceInfo(int custId, DateTime date,string strWhere)
        {
            return _productDal.GetPriceInfo(custId,date,strWhere);
        }

        public DataTable GetProductsWithPriceByPage(string strWhere, string custId, string strOrderBy, int pageIndex, int pageSize, out int recordCount, out int pageCount)
        {
            return _productDal.GetProductsWithPriceByPage(strWhere, custId, strOrderBy, pageIndex, pageSize,
                                                          out recordCount, out pageCount);
        }

        public void Disable(int productId)
        {
            _productDal.Disable(productId);
        }

        public void Enable(int productId)
        {
            _productDal.Enable(productId);
        }
    }
}
